package com.thinker.loan.consumer.service.strategy;

import com.thinker.loan.consumer.enumeration.LoanStatus;
import com.thinker.loan.consumer.model.LoanApplicationRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

import java.util.Random;

@ConditionalOnProperty(name = "loan.strategy", havingValue = "deepseek", matchIfMissing = true)
@Slf4j
public class DeepSeekApprovalStrategy implements ApprovalStrategy {
    @Override
    public void evaluate(LoanApplicationRequest request) {
        log.info("DeepSeek 开始做分析");
        // 模拟 DeepSeek 的智能分析过程
        if (new Random().nextBoolean()) {
            request.setStatus(LoanStatus.APPROVED);
        } else {
            request.setStatus(LoanStatus.REJECTED);
        }
    }
}
